package com.stores.v1.toolset;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

import com.google.appengine.api.rdbms.AppEngineDriver;

public class AppengineDatabase extends Database {

	/**
	 * @throws SQLException
	 * 
	 */
	public AppengineDatabase() throws SQLException {
		DriverManager.registerDriver(new AppEngineDriver());
		this.setConnectionString("jdbc:google:rdbms://ionlinestoresdb:default/ionlinestores");
	}

	@Override
	public Connection getOpenConnection()
			throws DatabaseInitializationException {
		try {
			return DriverManager.getConnection(this.getConnectionString(),
					"ultrauser", "b790-43c70b1b6ca2");
		} catch (SQLException e) {
			throw new DatabaseInitializationException(
					"Failed to initialize the database connection");
		}
	}
}
